<!-- 主题设置模板 -->

<script type="text/html" template lay-done="layui.data.theme();">
  {{# 
    var local = layui.data(layui.setter.tableName)
    ,theme = local.theme || {}
    ,themeColorIndex =  parseInt((theme && theme.color) ? theme.color.index : 0) || 0;
  }}

  <div class="layui-card-header">
    配色方案
  </div>
  <div class="layui-card-body layadmin-setTheme">
      <ul class="layadmin-setTheme-color">
        {{# layui.each(layui.setter.theme.color, function(index, item){ }}
          <li layadmin-event="setTheme" data-index="{{ index }}" data-alias="{{ item.alias }}"
          {{ index === themeColorIndex ? 'class="layui-this"' : '' }} title="{{ item.alias }}">
            <div class="layadmin-setTheme-header" style="background-color: {{ item.header }};"></div>
            <div class="layadmin-setTheme-side" style="background-color: {{ item.main }};">
              <div class="layadmin-setTheme-logo" style="background-color: {{ item.logo }};"></div>
            </div>
          </li>
        {{# }); }}
      </ul>
    </div>
  <div class="layui-card-header">
    菜单风格
  </div>
  <div class="layui-card-body layadmin-setTheme">
    <ul class="themestyle">
      <li style="height:30px;cursor:pointer;" id="2">默认风格</li>
      <li style="height:30px;cursor:pointer;" id="0">左侧单菜单风格</li>
      <li style="height:30px;cursor:pointer;" id="1">左侧树菜单风格</li>
      <li style="height:30px;cursor:pointer;" id="3">顶部树菜单风格</li>
<!--      <li style="height:30px;cursor:pointer;" id="4">顶部单菜单风格</li>-->
    </ul>
  </div>
  <div class="layui-card-header">
    tab页切换
  </div>
  <div class="layui-card-body layadmin-setTheme">
      <form class="layui-form" action="" lay-filter="isSwitchtype">
      <div class="layui-form-item">
        <label class="layui-form-label">开启页签</label>
        <div class="layui-input-block">
          <a href="javascript:;" layadmin-event="switchtype">
          <input type="checkbox" name="close" lay-skin="switch" lay-text="开启|关闭" >
          </a>
        </div>
      </div>
      </form>
  </div>
</script>

<script>
  layui.data.theme = function () {
    layui.use('form', function () {
      var form = layui.form
        , admin = layui.admin;
      //监听隐藏开关
      form.on('switch(system-theme-sideicon)', function () {
        admin.theme({
          hideSideIcon: this.checked
        })
      });
    });

    layui.use(['form','setter'], function () {
      var form = layui.form, admin = layui.admin,setter=layui.setter;
      form.render();
     form.val('isSwitchtype',{
        'close':layui.setter.pageTabs ?true:false
      })

    });

    layui.use([], function () {
      var $ = layui.jquery;
        
        $('.themestyle li').click(function(){
          localStorage.setItem('themetype',$(this).attr('id'));
          window.location.reload();
        })
      });
  };
</script>